<div id="usersinfo" align="center">
<form name="usersinfo_form" id="usersinfo_form">
<input type="hidden" name="scid" value="user_infoupdate">
<table width="400px" height="100px">
	<tr>
		<td>用户名：</td>
		<td><span id="username" /></td>
	</tr>
	<tr>
		<td>姓     名：</td>
		<td><input id="realname" type="text" name="realname"  value="" /></td>
	</tr>
	<tr>
		<td>邮     件：</td>
		<td><input id="email" type="text" name="email"  value="" /></td>
	</tr>
	<tr>
		<td>性     别：</td>
		<td><input id="gender" type="radio" name="gender"  value="0" >男
			<input id="gender" type="radio" name="gender" value="1" >女</td>
	</tr>
	<tr>
		<td>电     话：</td>
		<td><input id="phone" type="text" name="phone"  value="" /></td>
	</tr>
 
	<tr collspan="2">
		<td width="78px" height="30px"><input name="bsubmit" id="bsubmit" type="button" value="提交" /><div id="submiting"></div></td>	
	</tr>
</table>
</form>
</div>
 

<script type="text/javascript">
var dataURL = '/data/sc.action';//取数据的url
var mainPanel = 'mainPanel';
var fillcontent = function(){
 
 	$('username').set('html','${Session.user.username}');
 	$('realname').set('value','${Session.user.realname}');
 	$('email').set('value','${Session.user.email}');
 	$('phone').set('value','${Session.user.phone}');
 	var m = document.getElementsByName('gender'); 
	var l = m.length;
	for ( var i=0; i< l; i++){
		if(m[i].value==${Session.user.gender}) 
			$(m[i]).set('checked',true); 
	}		
}
 
 window.addEvent('domready', function() {
 	fillcontent();
	$('bsubmit').addEvent('click', function(e){
		$('usersinfo_form').set('send', {
    		url: dataURL, 
    		onSuccess:function(responseText, responseXML){
    			$('bsubmit').set('disabled', false);
    			$('submiting').innerHTML = '';
    			var myjson = JSON.decode(responseText);
    			if (myjson.error.errorcode==0){
    				MUI.notification('修改成功！');
    				MUI.updateContent({
						'element':  $(mainPanel),
						'url':      '/auth/users.action'
					});
    			}else{
    				MUI.notification('<font color=red>错误：</font>('+myjson.error.retstring+')');
    			}
    		},
    		onFailure:function(instance){
    			MUI.notification('<font color=red>错误：</font>访问失败('+instance+')');
    			$('bsubmit').set('disabled', false);
    			$('submiting').innerHTML = '';
    		}
		});
		$('bsubmit').set('disabled', true);
		$('submiting').innerHTML = '<img src="images/spinner.gif" width="16px" height="16px">';
		$('usersinfo_form').send();
	});
	 
 });


</script>